package com.test.daily.leetcode.y2022.m06.day0625.v01;

/**
 * @author Tom on 2022/6/25
 */
public class Solution {
    public int minCost(int[][] costs) {
        return process(-1, 0, 0, costs);
    }
    public static int process(int preColor,int preCost, int index, int[][] costs){
        if(index == costs.length){
            return 0;
        }
        int p1 = preColor == 0 ? Integer.MAX_VALUE : preCost + costs[index][0] + process(0, preCost + costs[index][0], index + 1, costs);
        int p2 = preColor == 1 ? Integer.MAX_VALUE : preCost + costs[index][1] + process(1, preCost + costs[index][1], index + 1, costs);
        int p3 = preColor == 2 ? Integer.MAX_VALUE : preCost + costs[index][2] + process(2, preCost + costs[index][2], index + 1, costs);
        int cur = Integer.MAX_VALUE;
        for (int i = 0; i < 3; i++) {

        }
        return Math.min(p1, Math.min(p2, p3));
    }
}
